package com.cat.dataStructure;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/best-sightseeing-pair/description/
 * @create 2025/8/14 14:28
 * @since JDK17
 */

public class Solution07 {
    public int maxScoreSightseeingPair(int[] values) {
        int ans = values[0], n = values.length, max = values[0];
        for (int i = 1; i < n; i++) {
            ans = Math.max(ans, max + values[i] - i);
            max = Math.max(max, values[i] + i);
        }
        return ans;
    }
}
